﻿namespace AbpPlus.Commands
{
	using System;
	using AbpPlus.Events;
	using FluentValidation.Results;

	using MediatR;

	/// <summary>
	/// The command.
	/// </summary>
	/// <typeparam name="TResponse">
	/// </typeparam>
	public abstract class Command<TResponse> : Message, IRequest<TResponse>
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="Command{TResponse}"/> class. 
		/// </summary>
		protected Command()
		{
			this.Timestamp = DateTime.Now;
		}

		/// <summary>
		/// Gets the timestamp.
		/// </summary>
		public DateTime Timestamp { get; private set; }

		/// <summary>
		/// Gets or sets the validation result.
		/// </summary>
		public ValidationResult ValidationResult { get; set; }

		/// <summary>
		/// The is valid.
		/// </summary>
		/// <returns>
		/// The <see cref="bool"/>.
		/// </returns>
		public abstract bool IsValid();
	}

	/// <summary>
	/// The command.
	/// </summary>
	public abstract class Command : Command<Unit>, IRequest
	{
	}
}